package pong.game;


import pong.game.location.LevelMap;
import pong.game.location.LoaderTexture;
import pong.game.objects.DinamicObject;
import pong.game.objects.Handle;
import pong.game.objects.Washer;
import pong.general.*;
import pong.mathematic.Vec2;
import android.graphics.Canvas;
import android.view.MotionEvent;

public abstract class Game 
{
	LevelMap				Map;
	public GameType			gameType;

	public 			Game(GameType gameType, int height, int width)
	{
		this.gameType	= gameType;
		Map				= new LevelMap(LoaderTexture.getBitmap(SocialPongActivity.context, R.drawable.background, 1, 1));
		
		DinamicObject 	buffer = null;
		
		switch(gameType)
		{
		case QuickGame:
			buffer = new Handle(LoaderTexture.getBitmap(SocialPongActivity.context, R.drawable.metal, 0.05f, 0.18f), WifiType.Server, 0.5f - 0.09f, 1.0f - 0.05f);
			Map.GameObjects.add(buffer);
			buffer = new Handle(LoaderTexture.getBitmap(SocialPongActivity.context, R.drawable.metal, 0.05f, 0.18f), WifiType.Server, 0.5f - 0.09f, 0.0f);
			Map.GameObjects.add(buffer);
			buffer = new Washer(LoaderTexture.getBitmap(SocialPongActivity.context, R.drawable.red, 0.05f, 
					(float)GameWindow.heightWorld / GameWindow.widthWorld * 0.05f), WifiType.Server, 0.5f - 0.025f, 0.5f - 0.025f);
			Map.GameObjects.add(buffer);
			buffer = new Washer(Map.GameObjects.get(2).bitmap, WifiType.Server, 0.3f, 0.7f);
			Map.GameObjects.add(buffer);
			buffer = new Washer(Map.GameObjects.get(2).bitmap, WifiType.Server, 0.7f, 0.3f);
			Map.GameObjects.add(buffer);
			break;
			
		case Company:
			break;
			
		case MultyPlayer1x1:
			break;
			
		case MultyPlayer2x2:
			break;
		}
		
		buffer = null;
	}
	
	public boolean	isWin()
	{
		return false;
	}
	public void		newGame()
	{
		
	}
	public void		render(Canvas canvas)
	{
		Map.render(canvas);
	}
	public void		run()
	{
		Map.GameObjects.get(0).newPower(new Vec2(SocialPongActivity.sensors.xPower, 0), 0.005f);
		Map.run();
	}
	public void		touchScanner(MotionEvent e)
	{
		
	}
	public void		destroy()
	{
		pause();
		
	}
	public void		pause()
	{
		
	}
	public void		start()
	{
		
	}
}
